<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: system.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_12cda917fe1d7c8b4e7d2501bb3636e4.html">sdk</a></li><li class="navelem"><a class="el" href="dir_2f23e30b638d6a5f333babd9a5d183e1.html">include</a></li><li class="navelem"><a class="el" href="dir_d5ace589187da7c83c1a7507ec9fbbef.html">sifteo</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">system.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * This file is part of the public interface to the Sifteo SDK.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright &lt;c&gt; 2012 Sifteo, Inc. All rights reserved.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#ifdef NOT_USERSPACE</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#   error This is a userspace-only header, not allowed by the current build.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;sifteo/abi.h&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;sifteo/macros.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">namespace </span>Sifteo {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html">   29</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_sifteo_1_1_system.html" title="Global operations that apply to the system as a whole.">System</a> {</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    </div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a683428ced5823dbade4077eae34fe865">   39</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a683428ced5823dbade4077eae34fe865" title="Leave the game immediately.">exit</a>() {</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;        _SYS_exit();</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    }</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a367fbb9a7e47b12d8a63915899b07568">   49</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a367fbb9a7e47b12d8a63915899b07568" title="Exit with a fault, for fatal error handling.">abort</a>() {</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        _SYS_abort();</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    }</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#ab3c6ac3aa37edcec5196035c3832f420">   68</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#ab3c6ac3aa37edcec5196035c3832f420" title="Temporarily give up control of the CPU.">yield</a>() {</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        _SYS_yield();</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    }</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a3676c1bc1e5891a686d2646d0ec516c6">   90</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a3676c1bc1e5891a686d2646d0ec516c6" title="Draw the next frame.">paint</a>() {</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        _SYS_paint();</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    }</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#ad55a6655ab46fcf2a2d083b38b16ce3e">  111</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#ad55a6655ab46fcf2a2d083b38b16ce3e" title="Draw the next frame, without an upper limit on frame rate.">paintUnlimited</a>() {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        _SYS_paintUnlimited();</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    }</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a36d92c44328916f60f62abf63d2ee7bd">  141</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a36d92c44328916f60f62abf63d2ee7bd" title="Wait for any previous paint() to finish.">finish</a>() {</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        _SYS_finish();</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;</div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a1cd0bb2448968b094fccf9aae9691992">  150</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_sifteo_1_1_system.html#a1cd0bb2448968b094fccf9aae9691992" title="Is this a debug build?">isDebug</a>() {</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <span class="keywordflow">return</span> _SYS_lti_isDebug();</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    }</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#aed1f21c2ec94d82e782adfb384b35e6a">  163</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_sifteo_1_1_system.html#aed1f21c2ec94d82e782adfb384b35e6a" title="Is this a debug build running in simulation?">isSimDebug</a>()</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    {</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;        <span class="keywordtype">unsigned</span> flag = 0;</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        <a class="code" href="group__macros.html#gaae31453655b2aac2b521a9e198a78863" title="Like SCRIPT(), but this variant supports format specifiers.">SCRIPT_FMT</a>(LUA, <span class="stringliteral">&quot;Runtime():poke(%p, 1)&quot;</span>, &amp;flag);</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;        <span class="keywordflow">return</span> flag;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    }</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;</div>
<div class="line"><a name="l00183"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a02b6ff38d7e7e672e941bb8ea4182b3b">  183</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">float</span> <a class="code" href="class_sifteo_1_1_system.html#a02b6ff38d7e7e672e941bb8ea4182b3b" title="Get the system&#39;s battery level.">batteryLevel</a>() {</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;        <span class="keywordflow">return</span> _SYS_sysBatteryLevel() / float(_SYS_BATTERY_MAX);</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    }</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a0a6ca5647030ec4510048b664c45d658">  200</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a0a6ca5647030ec4510048b664c45d658" title="Shut down the system.">shutdown</a>(<span class="keywordtype">bool</span> now = <span class="keyword">false</span>) {</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;        <span class="keywordflow">return</span> _SYS_shutdown(now ? 0 : _SYS_SHUTDOWN_WITH_UI);</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    }</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;</div>
<div class="line"><a name="l00212"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a7316e95e241754c58f55c761dbd3c1d1">  212</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a7316e95e241754c58f55c761dbd3c1d1" title="Prevent the system from shutting down due to inactivity.">keepAwake</a>() {</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;        _SYS_keepAwake();</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    }</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;</div>
<div class="line"><a name="l00236"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#a551bacdfb105214464f619940af15956">  236</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#a551bacdfb105214464f619940af15956" title="Set the range of cubes supported.">setCubeRange</a>(<span class="keywordtype">unsigned</span> minimum, <span class="keywordtype">unsigned</span> maximum) {</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;        _SYS_setCubeRange(minimum, maximum);</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;    }</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;</div>
<div class="line"><a name="l00243"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#ad820fc7af23749ddf0f58a52f63d602e">  243</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_sifteo_1_1_system.html#ad820fc7af23749ddf0f58a52f63d602e" title="Helper to specify a cube range with identical minimum and maximum counts.">setCubeRange</a>(<span class="keywordtype">unsigned</span> count) {</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;        _SYS_setCubeRange(count, count);</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    }</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;</div>
<div class="line"><a name="l00258"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#aed6a6aceb127578d8c9181325b01119d">  258</a></span>&#160;    <span class="keyword">static</span> uint32_t <a class="code" href="class_sifteo_1_1_system.html#aed6a6aceb127578d8c9181325b01119d" title="Returns the system&#39;s operating system version.">osVersion</a>() {</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;        <span class="keywordflow">if</span> ((_SYS_getFeatures() &amp; _SYS_FEATURE_SYS_VERSION) != 0) {</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;            <span class="keywordflow">return</span> _SYS_version() &amp; _SYS_OS_VERSION_MASK;</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        }</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        <span class="keywordflow">return</span> _SYS_OS_VERSION_NONE;</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;</div>
<div class="line"><a name="l00274"></a><span class="lineno"><a class="code" href="class_sifteo_1_1_system.html#aad99576978bcc107d064aaf466cbaaae">  274</a></span>&#160;    <span class="keyword">static</span> uint8_t <a class="code" href="class_sifteo_1_1_system.html#aad99576978bcc107d064aaf466cbaaae" title="Returns the hardware revision for the Sifteo base this application is running on.">hardwareVersion</a>() {</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keywordflow">if</span> ((_SYS_getFeatures() &amp; _SYS_FEATURE_SYS_VERSION) != 0) {</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;            <span class="keywordflow">return</span> _SYS_version() &gt;&gt; _SYS_HW_VERSION_SHIFT;</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;        }</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;        <span class="keywordflow">return</span> _SYS_HW_VERSION_NONE;</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;    }</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;};</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;}   <span class="comment">// namespace Sifteo</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
